Skip to content

Conversation

@lorenzodifuccia
Copy link

Fixes crash Error: expected a pointer in v7.0.11 when JVMTI is unavailable on some Android devices.

Fixed #380

Copilot AI review requested due to automatic review settings January 27, 2026 23:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in compileModule() when JVMTI is unavailable (e.g., missing EnsurePluginLoaded), which previously resulted in Error: expected a pointer.

Changes:

  • Writes a null pointer (ptr(0)) instead of null when api.jvmti is unavailable, preventing writePointer(null) from throwing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

let j = javaApi;
[
jvmti,
jvmti !== null ? jvmti : ptr(0),
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jvmti !== null ? jvmti : ptr(0) only guards the null case. On Dalvik, android.getApi() doesn't define jvmti at all (so it will be undefined), which would still be passed into writePointer() and can throw Error: expected a pointer. Consider using a nullish check (treating both null and undefined as absent) and defaulting to a null pointer (NULL/ptr(0)).

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix with jvmti ?? ptr(0)?
But I'm not sure about jvmti being undefined instead of null on Dalvik devices 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v7.0.11] Error: expected a pointer when JVMTI is unavailable

1 participant